import moduleRegist from '@/utils/moduleRegist';
import {
  module as paypayerModule
} from './module';
import {
  module as paypayerItemsModule
} from '../paypayerItems/module';

const Layout = resolve => {
  require(['./Layout'], resolve);
};

const PayChannel = resolve => {
  require(['./PayChannel'], resolve);
};

const TradingInquiry = resolve => {
  require(['./TradingInquiry'], resolve);
};

export default [
  /** 配置管理路由 */
  {
    path: 'payCenter',
    redirect: 'payCenter/PayChannel',
    component: Layout,
    meta: {
      title: '支付中心',
      name: '支付中心',
      permission: '',
      componentName: 'PaypayerLayout',
      keepAlive: true,
      icon: '',
      show: false
    },
    beforeEnter: (to, from, next) => {
      moduleRegist(paypayerModule);
      moduleRegist(paypayerItemsModule);
      next();
    },
    children: [{
      path: 'PayChannel',
      component: PayChannel,
      meta: {
        title: '支付渠道管理',
        name: '支付渠道管理',
        breadcrumb: '支付渠道列表',
        permission: 'invoice:taxpayer:query',
        keepAlive: true,
        componentName: 'PaypayerListView',
        icon: ''
      }
    },
    {
      path: 'TradingInquiry',
      component: TradingInquiry,
      meta: {
        title: '流水查询',
        name: '流水查询',
        breadcrumb: '流水查询',
        permission: 'invoice:taxpayer:add',
        show: true,
        keepAlive: true,
        componentName: 'PaypayerAddView',
        icon: 'md-people'
      }
    }]
  }
];
